package com.heima.user.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AdminAuthDto;
import com.heima.user.service.AdminAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/auth")
public class AdminAuthController {

    @Autowired
    private AdminAuthService adminAuthService;

    @Value("${spring.datasource.url}")
    private String url;

    @GetMapping("/test")
    public String test(){
        System.out.println(url);
        return url;
    }
    /**
     * 分页查询认证列表
     * @return
     */
    @PostMapping("/list")
    public ResponseResult findList(@RequestBody AdminAuthDto dto)
    {
        return adminAuthService.findList(dto);
    }

    /**
     * 审核通过
     */
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AdminAuthDto dto)
    {
        return adminAuthService.authPass(dto);
    }

    /**
     * 审核失败
     */
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AdminAuthDto dto)
    {
        return adminAuthService.authFail(dto);
    }
}
